<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>wguide1</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="wgpluck2.html" title="wgpluck2" />
    <link rel="next" href="wguide2.html" title="wguide2" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">wguide1</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="wgpluck2.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="wguide2.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="wguide1"></a>
      <div class="titlepage"></div>
      <a id="IndexWguide1" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">wguide1</span>
        </h2>
        <p>wguide1 — 
      A simple waveguide model consisting of one delay-line and one first-order lowpass filter.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp168131024"></a>
        <h2>Description</h2>
        <p>
      A simple waveguide model consisting of one delay-line and one first-order lowpass filter.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168132400"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>wguide1</strong></span> asig, xfreq, kcutoff, kfeedback</pre>
      </div>
      <div class="refsect1">
        <a id="idp168134560"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> -- the input of excitation noise.
    </p>
        <p>
      <span class="emphasis"><em>xfreq</em></span> -- the frequency (i.e. the inverse of delay time) Changed to x-rate in Csound version 3.59.
    </p>
        <p>
      <span class="emphasis"><em>kcutoff</em></span> -- the filter cutoff frequency in Hz.
    </p>
        <p>
      <span class="emphasis"><em>kfeedback</em></span> -- the feedback factor.
    </p>
        <p>
      <span class="emphasis"><em>wguide1</em></span> is the most elemental waveguide model, consisting of one delay-line and one first-order lowpass filter.
    </p>
        <p>
      Implementing waveguide algorithms as opcodes, instead of orc instruments, allows the  user to set <span class="emphasis"><em>kr</em></span> different than <span class="emphasis"><em>sr</em></span>, allowing better performance particulary when using real-time.
    </p>
        <p>
      </p>
        <div class="mediaobject">
          <img src="images/wguide1.png" alt="wguide1." />
          <div class="caption">
            <p>wguide1.</p>
          </div>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168145360"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the wguide1 opcode. It uses the file <a class="ulink" href="examples/wguide1.csd" target="_top"><em class="citetitle">wguide1.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp168147136"></a>
          <p class="title">
            <strong>Example 1046. Example of the wguide1 opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o wguide1.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1 - a simple noise waveform.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Generate some noise.</span>
  asig <span class="opc">noise</span> 20000, 0.5

  <span class="opc">out</span> asig
<span class="oblock">endin</span>

<span class="comment">; Instrument #2 - a waveguide example.</span>
<span class="oblock">instr</span> 2
  <span class="comment">; Generate some noise.</span>
  asig <span class="opc">noise</span> 20000, 0.5

  <span class="comment">; Run it through a wave-guide model.</span>
  kfreq <span class="opc">init</span> 200
  kcutoff <span class="opc">init</span> 3000
  kfeedback <span class="opc">init</span> 0.8
  awg1 <span class="opc">wguide1</span> asig, kfreq, kcutoff, kfeedback

  <span class="opc">out</span> awg1
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Play Instrument #1 for 2 seconds.</span>
<span class="stamnt">i</span> 1 0 2
<span class="comment">; Play Instrument #2 for 2 seconds.</span>
<span class="stamnt">i</span> 2 2 2
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168151456"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="wguide2.html" title="wguide2"><em class="citetitle">wguide2</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp168153568"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Gabriel Maldonado</td>
          </tr>
          <tr>
            <td>Italy</td>
          </tr>
          <tr>
            <td>October 1998</td>
          </tr>
        </table>
        <p>
    </p>
        <p>Example written by Kevin Conder.</p>
        <p>New in Csound version 3.49</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="wgpluck2.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="wguide2.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">wgpluck2 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> wguide2</td>
        </tr>
      </table>
    </div>
  </body>
</html>
